
<?php include_once 'common/header.php';  ?>
<!-- admin_main -->
<div class="admin_main">
	<!-- Admin_top end -->
	<?php include_once 'common/system_left.php';  ?>
	<!-- Admin_Left End -->
	<div class="admin_right">
	<div class="admin_right_title"><strong>系统管理</strong> >> 添加管理员</div>
		<div class="admin_right_info">
		<div class="payonline_form">
			<form action="/ychadmin/systemadmin/add/" method="post" id="form" name="form">
			<ul>
				<li>
					<font color="red"><?php echo @validation_errors(); ?></font>
				</li>

				<li>
					<div class="admin_right_info_tr admin_right_info_l">用户名：</div>
					<div class="admin_right_info_tr admin_right_info_m">
					<input type="text" name="name" id="name" size="20" value="<?php echo set_value('name');?>" />
					</div>
					<div class="admin_right_info_tr admin_right_info_r"><div id="nameTip"></div></div>
				</li>

				<li>
					<div class="admin_right_info_tr admin_right_info_l">管理密码：</div>
					<div class="admin_right_info_tr admin_right_info_m">
					<input type="password" name="password" id="password" size="20" value="<?php echo set_value('password');?>" />
					</div>
					<div class="admin_right_info_tr admin_right_info_r"><div id="passwordTip"></div></div>
				</li>
				<li>
					<div class="admin_right_info_tr admin_right_info_l">管理类型：</div>
					<div class="admin_right_info_tr admin_right_info_m">
					<select name="admin_type" id="admin_type" Onchange="setQQ();">
					<?php 
					foreach ($type as $k=>$v){ 
						if($v['name']=='客服'){
					?>
					<option data="<?php echo $v['id'];?>"  id="kftypeHeart" value="_selfHeart_"><?php echo $v['name'];?></option>
					<?php 
					    }else{
					?>
					<option value="<?php echo $v['id'];?>"><?php echo $v['name'];?></option>
					<?php
					   }
					}
					?>
				    </select>&nbsp;
					<input name="kftype" type="hidden" value="" id="kftype">
					<input name="qq" id="iheart" style="display:none;" value="" size="14" maxlength="10" onfocus="clearit(this);"/> 
					</div>
					<div class="admin_right_info_tr admin_right_info_r"><div id="moduleTip"></div> </div>
				</li>
				<li>
					<div class="admin_right_info_tr admin_right_info_l">管理员备注：</div>
					<div class="admin_right_info_tr admin_right_info_m">
					<input type="text" name="remark" id="remark" size="60"  value="<?php echo set_value('remark');?>" />
					</div>
					<div class="admin_right_info_tr admin_right_info_r"><div id="remarkTip"></div> </div>
				</li>
				<li>
					<div class="payment_btm">
						<input type="submit" value="提交"  class="btn_b"/>
					</div>
				</li>
			</ul>
			</form>
			</div>
			</div>
	</div>
<!-- Admin_Right End -->
</div>
<!-- admin_main end -->
<script type="text/javascript">
$(document).ready(function(){
	$.formValidator.initConfig({formID:"form",debug:false,submitOnce:true,
		onError:function(msg,obj,errorlist){
			$("#errorlist").empty();
			$.map(errorlist,function(msg){
				$("#errorlist").append("<li>" + msg + "</li>")
			});
			alert(msg);
		},
		submitAfterAjaxPrompt : '有数据正在异步验证，请稍等...'
	});
    $("#name").formValidator({autoModify:true,onShow:"",onFocus:"用户名在2-30个字符之间",onCorrect:""}).inputValidator({min:2,max:30,onError:"用户名不能为空,请确认"});
    $("#password").formValidator({autoModify:true,onShow:"",onFocus:"密码在3-15个字符之间",onCorrect:""}).inputValidator({min:3,max:15,empty:{leftempty:false,rightempty:false,emptyerror:"密码两边不能有空符号"},onError:"密码不能为空,请确认"});
});
function setQQ(){
	if(document.getElementById("admin_type").value == "_selfHeart_"){
		document.getElementById("iheart").style.display = "";
		document.getElementById("iheart").style.color = "#c0c0c0";
		document.getElementById("iheart").value = "请输入客服QQ";
		document.getElementById("kftype").value = $("#kftypeHeart").attr('data');
	}else{
		document.getElementById("iheart").style.display = "none";
		document.getElementById("iheart").value = document.getElementById("admin_type").value;
		document.getElementById("kftype").value = "";
	}
}
function clearit(obj){
	if(obj.value=="请输入客服QQ")
	{
		obj.value="";
		obj.style.color="#000000";
	}
}
</script>
<div id="dialog" title="系统提示" style="display:none"><p id="msg" style="text-align:center"></p></div>
</body>
</html>